import com.aliyun.vod.upload.impl.UploadVideoImpl;
import com.aliyun.vod.upload.req.UploadVideoRequest;
import com.aliyun.vod.upload.resp.UploadVideoResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.vod.model.v20170321.*;
import org.junit.Test;

import java.util.List;

public class test {
@Test
    public void tesVideo () throws Exception {
    DefaultAcsClient defaultAcsClient = Init.initVodClient("LTAI4GBtZrwGp1ByCgW5ntSk", "58glZOCBotKspNaB8yS4vd9OjYBJ8I");
    GetPlayInfoResponse response;
    GetPlayInfoRequest request=new GetPlayInfoRequest();
    request.setVideoId("2b4688e226e14840a6edac3cf4db9e4e");
    response=defaultAcsClient.getAcsResponse(request);
    List<GetPlayInfoResponse.PlayInfo> playInfoList = response.getPlayInfoList();
    //获取视频播放的url
    for (GetPlayInfoResponse.PlayInfo playInfo : playInfoList) {
        System.out.print("PlayInfo.PlayURL = " + playInfo.getPlayURL() + "\n");
    }
    //Base信息
    System.out.print("VideoBase.Title = " + response.getVideoBase().getTitle() + "\n");
}
//获取凭证
@Test
    public void VideoAuth() throws Exception{
    DefaultAcsClient defaultAcsClient = Init.initVodClient("LTAI4GBtZrwGp1ByCgW5ntSk", "58glZOCBotKspNaB8yS4vd9OjYBJ8I");
    GetVideoPlayAuthRequest request=new GetVideoPlayAuthRequest();
    GetVideoPlayAuthResponse response;
    request.setVideoId("2b4688e226e14840a6edac3cf4db9e4e");
    response = defaultAcsClient.getAcsResponse(request);
    System.out.println(response.getPlayAuth());
}
//上传文件
    @Test
    public void uploadFile(){
    //设置密钥
        UploadVideoRequest request=new UploadVideoRequest("","","","");
        //初始化对象
        UploadVideoImpl impl=new UploadVideoImpl();
        //响应对象
        UploadVideoResponse response;
        //设置断片
        request.setPartSize(1*1024*1024L);
        //设置并发量 
        request.setTaskNum(1);
        //上传文件
        response=impl.uploadVideo(request);
        response.getVideoId();

    }
}
